
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>第三方 - 小程序代码上传</title>
    


    <link rel="shortcut icon" href="favicon.ico">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/font-awesome/4.4.0/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/Admin/css/style.min.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    
    
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>第三方
                        <small>小程序代码上传</small>
                    </h5>
                    
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">应用名称</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="appname" value="{$info['appname']}" id="appname">
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">应用的appid</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="appid" id="appid" value="{$info['appid']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">描述</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="user_desc" id="user_desc" value="">
                                
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">提交版本</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="user_version" id="user_version"  value="">
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">小程序模板代码id</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="template_id" value="" id="template_id">
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                       
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="button" onClick="save()">保存内容</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/Public/Admin/js/contabs.min.js?v=1.0"></script>
<script src="/Public/Admin/js/plugins/layer/layer.js?v=1.0"></script>
<script>

    var lock = 0;
    function save()
    {
        layer.msg('提交中', {icon: 1});
        if(lock == 1){ return false;}

        var url = "{:U('Auth/uploadcode')}";
        $.ajax({
            type : 'post',
            url  : url+'?t='+Math.random(),
            data : $("form").serialize(),
            dataType : 'json',
            beforeSend: function(){
                lock = 1;
                layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
            },
            success : function(res){
                layer.closeAll();
                if(res.errcode == 0){
                    layer.msg('提交成功', {icon: 1});

                    var t = window.setTimeout("reload()",2000);

                }else{
                    layer.msg(res.errcode, {icon: 2});
                }
            },
            complete: function(){
                lock = 0;
            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                layer.closeAll();
                layer.msg('网络失败，请刷新页面后重试', {icon: 2});
            }
        })
    }


    function reload()
    {
        var appid = $('#appid').val();
        if (appid=='wx402ce3c8d9a9de9b') {
            location.href = "{:U('Auth/lyricist')}?";
        }else if (appid=='wxe180236290032484') {
            location.href = "{:U('Auth/lyricist')}?";
     }else if (appid=='wx752ceb8e4e1200e3'){
            location.href = "{:U('Auth/auth')}?";
        }
       
    }
	
</script>

</body>

</html>
